<?php
namespace app\admin\model;

use think\Model;
use app\services\TokenService;

class BaseModel extends Model
{
    protected static function tokenToUid() {
        $cacheValue = TokenService::tokenToCachedValue();
        return $cacheValue['id'];
    }

    protected static function tokenToScope() {
        $cacheValue = TokenService::tokenToCachedValue();
        return $cacheValue['scope'];
    }

    protected static function grantToken() {
        $token = trim(ltrim(request()->header('Authorization'), 'Bearer'));
        return $token;
    }
}